package cn.new7as.cas5s.ui.record;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

import java.util.List;

import cn.new7as.cas5s.R;
import cn.new7as.cas5s.ui.easy.netapi.UtrSendApi;

public class FeedBackAdapter extends BaseAdapter {

    private List<UtrSendApi.Data> list;
    private RecordsDetailActivity context;


    public FeedBackAdapter(List<UtrSendApi.Data> list, RecordsDetailActivity context) {
        super();

        this.context = context;
        this.list = list;

    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder viewHolder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.layout_gride_utr, parent, false);
            viewHolder = new ViewHolder();
            viewHolder.upload = (ImageView) convertView.findViewById(R.id.upload);


            convertView.setTag(viewHolder);

        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }

        viewHolder.upload.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        UtrSendApi.Data dataBean = list.get(position);
        Glide.with(context).load(dataBean.hjadkvsa).into(viewHolder.upload);

        return convertView;
    }

    static class ViewHolder {
        ImageView upload;

    }
}
